package com.googlecode.kipler.transformations;

import com.googlecode.kipler.syntax.concept.AtConcept;
import com.googlecode.kipler.syntax.concept.BooleanConcept;
import com.googlecode.kipler.syntax.concept.Bottom;
import com.googlecode.kipler.syntax.concept.CardinalityRestriction;
import com.googlecode.kipler.syntax.concept.ConceptName;
import com.googlecode.kipler.syntax.concept.ConceptVisitor;
import com.googlecode.kipler.syntax.concept.NaryBooleanConcept;
import com.googlecode.kipler.syntax.concept.Nominal;
import com.googlecode.kipler.syntax.concept.QualifiedNoRestriction;
import com.googlecode.kipler.syntax.concept.RoleQuantification;
import com.googlecode.kipler.syntax.concept.Top;

public class NominalSearchingVisitor implements ConceptVisitor {

	private boolean hasNominal;

	private Nominal nominal;

	public NominalSearchingVisitor(Nominal nominal) {
		super();
		this.nominal = nominal;
	}

	public boolean hasNominal() {
		return hasNominal;
	}

	@Override
	public void visitAtConcept(AtConcept c) {
		// should not implement this
	}

	@Override
	public void visitBooleanConcept(BooleanConcept bd) {
		NominalSearchingVisitor lvisitor = new NominalSearchingVisitor(nominal);
		bd.getLhs().accept(lvisitor);
		NominalSearchingVisitor rvisitor = new NominalSearchingVisitor(nominal);
		bd.getRhs().accept(rvisitor);
		hasNominal = lvisitor.hasNominal() || rvisitor.hasNominal();
	}

	@Override
	public void visitCardinalityRestriction(CardinalityRestriction restriction) {
		// TODO Auto-generated method stub

	}

	@Override
	public void visitConceptName(ConceptName c) {
		// TODO Auto-generated method stub

	}

	@Override
	public void visitNominal(Nominal nominal) {
		hasNominal = nominal.equals(this.nominal);
	}

	@Override
	public void visitQualifiedNoRestriction(QualifiedNoRestriction restriction) {
		// TODO Auto-generated method stub

	}

	@Override
	public void visitRoleQuantification(RoleQuantification restriction) {
		// TODO Auto-generated method stub

	}

	@Override
	public void visitBottom(Bottom bottom) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void visitTop(Top top) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void visitNaryBooleanConcept(NaryBooleanConcept c) {
		// TODO Auto-generated method stub
		
	}

}
